package
{
	import com.fellong.flash.flar.object.ext.FlarARisCube;
	
	import org.papervision3d.materials.BitmapFileMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.events.FileLoadEvent;
	import org.papervision3d.objects.special.DAEMC2;
	import org.papervision3d.materials.BitmapMaterial;
	import org.papervision3d.lights.PointLight3D;
	import org.papervision3d.materials.shaders.FlatShader;
	import org.papervision3d.materials.shaders.ShadedMaterial;

	public class FlarMikuBox extends FlarARisCube
	{		
		public var _body:DAEMC2;
		public var _bodyMaterial:BitmapFileMaterial;
		
		public function FlarMikuBox( cube_space:Number=3, erase_green_cube:Boolean=true )
		{
			super(cube_space,erase_green_cube);
			
			_body = new DAEMC2( false, null, 0 );
			_body.scale = 4;
			this.pivot.addChild(_body);

			_bodyMaterial = new BitmapFileMaterial();
			_bodyMaterial.addEventListener( FileLoadEvent.LOAD_COMPLETE, matLOAD_COMPLETE );			
			_bodyMaterial.texture = "Data/miku.png";
		}
		
	    private function matLOAD_COMPLETE( event:FileLoadEvent ):void
	    {
			_bodyMaterial.removeEventListener( FileLoadEvent.LOAD_COMPLETE, matLOAD_COMPLETE );

			var ml:MaterialsList = new MaterialsList({miku_png_001:_bodyMaterial,miku_png_002:_bodyMaterial,miku_png_003:_bodyMaterial,miku_png_004:_bodyMaterial});
			_body.load( "Data/miku.dae", ml );
		}

	}
}